#include <iostream>
#include <typeinfo>
//rtti : runtime type identification  运行时类型识别
//rtti : 在有虚表的时候

// 重载和重写？
// 
class Base1
{
public:
    virtual void show(){}
};

class Derived:public Base1
{
public:
    virtual void show(){}
};

class Derived2:public Base1
{};

struct Type
{
    void*p;
};

int main()
{   
    Base1 *b = new Derived;
    b = new Derived2;
    std::cout<<b<<std::endl;
    Derived *d = dynamic_cast<Derived*>(b);//RTTI
    std::cout<<d<<std::endl;
    //运行时多态
    // std::cout<<typeid(*b).name()<<std::endl;
    // if(typeid(*b) == typeid(Derived))
    // {
    //     Derived *d = dynamic_cast<Derived*>(b);
    //     std::cout<<"类型相同"<<std::endl;
    // }
    return 0;
}